//思路：


import java.util.*;

public class Solution {
    public static void main(String[] args) {

   }
}
class MyQueue {
   private Stack<Integer> stack1;
    private Stack<Integer> stack2;

    public MyQueue() {
   stack1=new Stack<>();
   stack2=new Stack<>();
    }

    public void push(int x) {
         stack1.push(x);
    }

    public int pop() {
        if (stack2.empty()) {
            while(!stack1.empty()){
                int x=stack1.pop();
                stack2.push(x);
            }
        }
       return stack2.pop();
    }

    public int peek() {
       int n=this.pop();
       stack2.push(n);
       return n;
    }

    public boolean empty() {
     return stack1.empty()&&stack2.empty();
    }
}













